﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Sisocana.Models
{
    public class MasterPageModel
    {
        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 3)]
        [Display(Name = "Name")]
        public string Name { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [Display(Name = "Description")]
        public string Description { get; set; }

        [Required(ErrorMessage = "You must select a MasterPage file")]
        [Display(Name = "Select the master page")]
        public HttpPostedFileBase File { get; set; }
    }

    public class StylesheetModel
    {
        [Required]
        public int Index { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 3)]
        [Display(Name = "CSS name")]
        public string Name { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [Display(Name = "CSS description")]
        public string Description { get; set; }

        [Required(ErrorMessage = "You must select a stylesheet file")]
        [Display(Name = "Select a stylesheet")]
        public HttpPostedFileBase File { get; set; }

        public StylesheetModel() { }

        public StylesheetModel(int id)
        {
            Index = id;
        }
    }

    public class LoadMasterPageAndCssModel
    {
        public int? SiteId { get; set; }

        public MasterPageModel MasterPage { get; set; }

        public IEnumerable<StylesheetModel> Stylesheets { get; set; }

        [Display(Name = "Select a zip file with the images")]
        public HttpPostedFileBase Images { get; set; }

        [Display(Name = "Select a zip file with the scripts")]
        public HttpPostedFileBase Scripts { get; set; }

        public LoadMasterPageAndCssModel() : this(null)
        {

        }

        public LoadMasterPageAndCssModel(int? id)
        {
            SiteId = id;
            Stylesheets = new List<StylesheetModel>() { new StylesheetModel() };
        }
    }
}